package com.ruoyi.project.device.msgXdkSsj.controller;

import java.util.List;

import com.ruoyi.project.device.msgXdkSsj.domain.MsgXdkSsj;
import com.ruoyi.project.device.msgXdkSsj.service.IMsgXdkSsjService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 巷道口输送机Controller
 * 
 * @author qxq
 * @date 2024-04-23
 */
@Controller
@RequestMapping("/device/msgXdkSsj")
public class MsgXdkSsjController extends BaseController
{
    private String prefix = "device/msgXdkSsj";

    @Autowired
    private IMsgXdkSsjService msgXdkSsjService;

    @GetMapping()
    public String msgXdkSsj()
    {
        return prefix + "/msgXdkSsj";
    }

    /**
     * 查询巷道口输送机列表
     */
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(MsgXdkSsj msgXdkSsj)
    {
        startPage();
        List<MsgXdkSsj> list = msgXdkSsjService.selectMsgXdkSsjList(msgXdkSsj);
        return getDataTable(list);
    }

    /**
     * 导出巷道口输送机列表
     */
    @Log(title = "巷道口输送机", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ResponseBody
    public AjaxResult export(MsgXdkSsj msgXdkSsj)
    {
        List<MsgXdkSsj> list = msgXdkSsjService.selectMsgXdkSsjList(msgXdkSsj);
        ExcelUtil<MsgXdkSsj> util = new ExcelUtil<MsgXdkSsj>(MsgXdkSsj.class);
        return util.exportExcel(list, "巷道口输送机数据");
    }

    /**
     * 新增巷道口输送机
     */
    @GetMapping("/add")
    public String add()
    {
        return prefix + "/add";
    }

    /**
     * 新增保存巷道口输送机
     */
    @RequiresPermissions("device:msgXdkSsj:add")
    @Log(title = "巷道口输送机", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    @ResponseBody
    public AjaxResult addSave(MsgXdkSsj msgXdkSsj)
    {
        return toAjax(msgXdkSsjService.insertMsgXdkSsj(msgXdkSsj));
    }

    /**
     * 修改巷道口输送机
     */
    @RequiresPermissions("device:msgXdkSsj:edit")
    @GetMapping("/edit/{id}")
    public String edit(@PathVariable("id") String id, ModelMap mmap)
    {
        MsgXdkSsj msgXdkSsj = msgXdkSsjService.selectMsgXdkSsjById(id);
        mmap.put("msgXdkSsj", msgXdkSsj);
        return prefix + "/edit";
    }

    /**
     * 修改保存巷道口输送机
     */
    @RequiresPermissions("device:msgXdkSsj:edit")
    @Log(title = "巷道口输送机", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    @ResponseBody
    public AjaxResult editSave(MsgXdkSsj msgXdkSsj)
    {
        return toAjax(msgXdkSsjService.updateMsgXdkSsj(msgXdkSsj));
    }

    /**
     * 删除巷道口输送机
     */
    @RequiresPermissions("device:msgXdkSsj:remove")
    @Log(title = "巷道口输送机", businessType = BusinessType.DELETE)
    @PostMapping( "/remove")
    @ResponseBody
    public AjaxResult remove(String ids)
    {
        return toAjax(msgXdkSsjService.deleteMsgXdkSsjByIds(ids));
    }
}
